<?php
$arrEstados = taxonomy_get_tree(3);

global $base_url;

$objTaxonomia = new stdClass();
$strEstado = "";

getNavegacaoEstado($objTaxonomia, $strEstado);
?>
<div class="nav-mobile">
    <header>
        <div class="nav-search-mobile">
            <div class="glyphicon glyphicon-search"></div>
            <form class="nav-search" method="get" action="<?= $base_url ?>/busca">
                <div class="input-group">
                    <input type="text" class="form-control" value="<?= @$_GET["title"]?>" name="title" placeholder="Busque por palavra-chave...">
                    <span class="input-group-btn">
                        <button type="submit" class="btn btn-primary">
                            <div class="glyphicon glyphicon-search"></div>
                        </button>
                    </span>
                </div>
            </form>
        </div>
        <div class="qgdi-mobile">
            <a href='<?php print $front_page;?>'>
                <img src="<?= $base_url ?>/sites/all/themes/qgdi/images/qgdi-logo-mobile.png" width="125" height="32">
            </a>
        </div>
    </header>
    <div id="mobile-ico">
        <div></div>
        <div></div>
        <div></div>
    </div>

    <div id="menu-mobile">
    <ul class="menu-primary">
<!--        <li><a href=''>Institucional</a></li>
        <li><a href=''>Comunicação</a></li>
        <li><a href=''>Linha Slim</a></li>
        <li><a href=''>Contato</a></li>-->
        <?php
            $arrMenuMobile = menu_navigation_links('menu-menu-mobile');
            $tam_arr = count($arrMenuMobile);
            @$classes_menu = 'menu-menu-mobile';
            $contador = 1;

            foreach ($arrMenuMobile as $item):
                $nome_item = @$item['title'];

                if($item['href'] == "empreendimentos-home")
                   $url_item = "";
                else
                    $url_item = $base_url ."/". drupal_get_path_alias($item['href']);


                if ($tam_arr === $contador) {
                    $classes_menu = $classes_menu . ' last';
                }$contador++;
        ?>
                <li class='<?php print $classes_menu; ?>'>
                    <a href="<?php print $url_item; ?>">
                        <?php print $nome_item; ?>
                    </a>
                </li>
        <?php 
            endforeach; 
        ?>
    </ul>
    <ul class="menu-secundary">
        <li class='canal-qg'><a href='http://www.qgdi.com.br/canalqg/index.php' target="_blank"> Canal QG </a></li>
        <li class='portal-client'><a href='https://portais.qgdi.com.br/cliente' target="_blank">Portal do Cliente</a></li>
    </ul>

    </div>
</div>
<div class="input-group" style="display:none;">
    <input type="text" class="form-control" placeholder="Busque por palavra-chave...">
</div>
<header>
    <div id="nav-top-primary">
        <div class="container">
            <div class="row">
                <div class="col-md-4">
                    <ul>
                    <?php
                        $tam_arr = count(@$main_menu);
                        @$classes_menu = 'main-menu';
                        $contador = 1;

                        foreach ($main_menu as $item):
                            $nome_item = @$item['title'];
                        
                            if($item['href'] == "empreendimentos-home")
                               $url_item = "";
                            else
                                $url_item = $base_url ."/". drupal_get_path_alias($item['href']);


                            if ($tam_arr === $contador) {
                                $classes_menu = $classes_menu . ' last';
                            }$contador++;
                    ?>
                            <li class='<?php print $classes_menu; ?>'>
                                <a href="<?php print $url_item; ?>">
                                    <?php print $nome_item; ?>
                                </a>
                            </li>
                    <?php 
                        endforeach; 
                    ?>
                    </ul>
                </div>
                <div class="pull-right">
                    <ul class="nav-user">
                        <li class="canal-qg"><a href="">Canal QG</a></li>
                        <li class="portal-client"><a href="">Portal do Cliente</a></li>

                        <select class="form-control filtrarEstado">
                            <option>Selecione um estado</option>
                        <?php
                            foreach ($arrEstados as $value):
                                $nome_item = strtolower($value->name);
                        ?>
                            <option <?php if(@strtolower($objTaxonomia->name) == $nome_item){ ?> selected="selected" <?php } ?>> <?php print $nome_item; ?> </option>
                        <?php endforeach; ?>
                        </select>
                        <li class="country"><a href=""><img src="<?= $base_url ?>/sites/all/themes/qgdi/images/flag-eua.jpg" width="28" height="21"></a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div id="nav-top-secundary">
        <div class="container">
            <div class="row">
<?php if ($logo): ?>
                <div class='logo'><a href='<?php print $front_page ?>'><img src='<?php print $logo ?>' alt='<?php //print $site_name_and_slogan ?>' title="<?php //print $site_name_and_slogan ?>"></a></div>
            <?php endif; ?>
            <div class="col-md-6">
                <form class="nav-search" method="get" action="<?= $base_url ?>/busca">
                    <div class="input-group">
                        <input type="text" class="form-control" value="<?= @$_GET["title"]?>" name="title" placeholder="Busque por palavra-chave...">
                        <span class="input-group-btn">
                            <button type="submit" class="btn btn-primary">
                                <div class="glyphicon glyphicon-search"></div>
                            </button>
                        </span>
                    </div>
                </form>
            </div>

                <div class="nav-button-group">
                    <div class="btn-filter">Filtrar</div>
                    <div>
                        <ul class="filter">
                            <li>
                                <select name="Estado" id="strEstadoFiltro">
                                    <option value="">Selecione o estado</option>
                                    <?php
                                        foreach ($arrEstados as $value):
                                            $nome_item = trim($value->name);
                                    ?>
                                            <option value="<?= $value->tid ?>"><?= $nome_item ?></option>
                                    <?php 
                                        endforeach; 
                                    ?>
                                </select> 
                            </li>
                            <li>
                                <select name="" id="strTipo" disabled="disabled">
                                    <option value="">Tipo</option>
                                </select> 
                            </li>
                            <li>
                                <select name="" id="strCidade">
                                    <option value="">Cidade</option>
                                </select> 
                            </li>
                            <li>
                                <select name="" id="strArea" disabled="disabled">
                                    <option value="">Área</option>
                                </select> 
                            </li>
                            <li>
                                <select name="" id="strBairro">
                                    <option value="">Bairro</option>
                                </select> 
                            </li>
                            <li>
                                <select name="" id="strEmpreendimento" disabled="disabled">
                                    <option value="">Nome</option>
                                </select> 
                            </li>
                            <li>
                                <select name="" id="strStatusObra" disabled="disabled">
                                    <option value="">Status</option>
                                </select> 
                            </li>
                            <button class="btn-filter btFiltrar" style="border: none;">Ok</button>
                        </ul>
                    </div>
                    <?php
                        $strImg = (!empty($objTaxonomia->name)) ? "/". strtolower(trim($objTaxonomia->name)) : "";
                    ?>
                    <a href="<?= $base_url ?>/todos-empreendimentos<?= (!empty($strEstado)) ? "/". strtolower(trim($strEstado)) : "" ?>"><span class="btn-all-r-estate">Todos empreendimentos</span></a>
                    <a href="<?= $base_url ?>/blog"><div class="btn-blog">blog</div></a>
                </div>
            </div>
        </div>	
    </div>
</header>